﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ControlLibrary.ComponentModel {
    /// <summary>
    /// A user interface for representing and editing the values of objects at Design-Time.
    /// </summary>
    internal partial class FormPickerEditor : Form {
        #region Properties
        
        private object _value;
        public object Value {
            get { return _value; }
        }

        #endregion

        #region Contructors

        public FormPickerEditor() {
            InitializeComponent();
        }

        #endregion

        #region Event Handlers

        private void btnOK_Click(object sender, EventArgs e) {
            if(componentDescriptionBindingSource.Current != null) {
                _value = ((ComponentDescription)componentDescriptionBindingSource.Current).Type;
            }
        }

        #endregion

        #region Public Methods

        public void FillDataGrid(List<ComponentDescription> componentList) {
            componentDescriptionBindingSource.DataSource = typeof(ComponentDescription);
            componentDescriptionBindingSource.DataSource = componentList;
        }

        #endregion
    }
}
